package com.huaguoguo.cyg.converter;

import cn.hutool.core.bean.BeanUtil;
import com.huaguoguo.cyg.entity.tl.dto.TlServerDTO;
import com.huaguoguo.cyg.entity.tl.to.ServerInfo;

import java.util.function.Function;

/**
 * 类说明： tl的dto转化器<br/>
 * author:huaguoguo
 * Date: 2020/2/22
 * Time: 14:23
 */
public class TLDTOConverter {

    /**
     * ServerInfo -> TlServerDTO 转化函数
     * @return TlServerDTO
     */
    public static Function<ServerInfo, TlServerDTO> tlServerInfoDTOconvert(){
        return t -> {
            TlServerDTO tlServerDTO = TlServerDTO.builder().build();
            BeanUtil.copyProperties(t,tlServerDTO);
            return tlServerDTO;
        };
    }
}
